See also Scripting Basics in the Tutorial Section
Variables
All variables are global û they are valid for all pages.
The variables are internally float (3.1415) not integer (3)
You donÆt have to define variable û all variables have default
value 0.
Example:
a = a + 1
See Also String Variables
Arrays
Variables can be in arrays:
Example:
A[1] = 0
A[b+1] = A[b]
You donÆt have to declare the arrays and arrays can be also
negative
or use this syntax for string arrays:
A$[1] = 'O'
A$[2] = 'K'
B$
= A$[1] + A$[2]
You can use the basic operations * / + - etcà
Boolean operators = < > & |
The If - Then - Else statement
The if statement controls conditional branching. The
body of an if statement is executed if the value of the
expression is nonzero.
The keyword then is not required but the interpreter
will inserted it there.
Expression can use any combination:
a<=b; a<>b; a=b; a=>b; a<b; a>b
You can use booleans & for AND, | for OR
If(a=b & a<10) Then
End
...
The keyword end must close the inner code.
Example:
A = A+1
If(a>4) Then
Show("text1")
Show("Rect1")
Else
Show("Rect2")
End
You can have if statement nested inside other if statements û but donÆt do it if you can avoid it û the code will be messy
Important û there is no else command, you have to make another if statement instead.
For û next loop
The syntax is typical Basic syntax
Example:
For c = 1 to 5
** functions
Next c
The loop can be counting up or down:
For c = 5 To 1
** functions
Next c
To exit from the loop you can use the Return() command (this will exit the Script)
NOTE: The For û next loop can cause a raising the level of CPU usage. Therefore, use it only when you really need it. To avoid raising CPU use the combination of ScriptTimers and increasing an integer variable. Open the ScrollingText.mbd or giflikeanim_frommasterpage.mbd samples to see how.
Infinite loop
In special cases (Semi-Parallel process) you may want to
use infinite loop. It has syntax of:
For c = 0 To Infinity
...
Next c
For more about this refer to the Semi-Parallel processes.
See Functions
See String
Variables